//
//  MainViewReqest.m
//  One
//
//  Created by mac on 16/5/21.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "MainViewReqest.h"
#import "HPObject.h"

@implementation MainViewReqest
+ (NSArray *)requestMainViewData
{
    __block NSArray *hpArray = nil;
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    [manager GET:@"http://v3.wufazhuce.com:8000/api/hp/more/0" parameters:nil progress:^(NSProgress * _Nonnull downloadProgress) {
            
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        if (responseObject) {
            NSDictionary *dic = (NSDictionary *)responseObject;
            NSArray *array = dic[@"data"];
                
            hpArray = [HPObject mj_objectArrayWithKeyValuesArray:array];
            [NOTI_CENTER postNotificationName:@"mainView" object:hpArray];
        }
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
    }];
    return hpArray;
    
}


@end
